package com.citsin.atlas

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.provider.MediaStore
import android.util.Log
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.findNavController
import com.citsin.atlas.viewmodel.AlbumViewModel
import com.citsin.atlas.viewmodel.MediaViewModel
import com.citsin.atlas.viewmodel.MediaViewModelProviderFactory

private const val TAG = "MainActivity"
class MainActivity : AppCompatActivity() {

//    private lateinit var viewModel:AlbumViewModel

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val bundle  = Bundle()
        val types = arrayOf(
            MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE,
            MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO
        )
        bundle.putIntArray("types",types.toIntArray())
        findNavController(R.id.fragment_container)
            .setGraph(R.navigation.atlas_nav_graph, bundle)
//        viewModel = ViewModelProvider.AndroidViewModelFactory.getInstance(application).create(AlbumViewModel::class.java)
//        viewModel.getAlbums().observe(this, Observer {
//            Log.v(TAG,"album size ${it.size}")
//
//            it.forEach {
//                Log.v(TAG,"album name ${it.displayName}/ ${it.id}")
//            }
//        })
    }

}
